package com.wealth.member.web.controller;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.wealth.order.entity.VoucherRecord;
import com.wealth.order.service.IVoucherRecordService;
import com.wealth.system.web.controller.BaseController;

/**
 * @author chan
 * 代金券
 */
@Controller
@RequestMapping("/manage/voucherRecord")
public class VoucherRecordController extends BaseController {
	
	Logger logger = Logger.getLogger(VoucherRecordController.class);
	
	@Autowired
	private IVoucherRecordService recordService;
	
	/**
	 * 代金券详情
	 */
	@RequestMapping(value="/{id}")
	public String voucherInfoForm(Model model,@PathVariable Long id){
		try {
			VoucherRecord record =recordService.get(id);
			model.addAttribute("record", record);
			if(record.getGoods()==null){
				return "member/voucherRecord/pickedInfo";
			}else{
				return "member/voucherRecord/info";
			}
		} catch (Exception e) {
			return "system/500";
		}
	}
	
}


